package org.jeecg.modules.wo.persontype.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Description: 人员类别树
 * @Author: jeecg-boot
 * @Date:   2022-03-22
 * @Version: V1.0
 */
@Data
@ApiModel(value="人员类别树对象", description="人员类别树对象")
public class WoPersonTypeTree extends WoPersonType {
    private static final long serialVersionUID = 1L;
    /** 对应SysDepart中的id字段,前端数据树中的key*/
    private String key;
    /** 对应SysDepart中的id字段,前端数据树中的value*/
    private String value;
    /** 对应depart_name字段,前端数据树中的title*/
    private String title;
    private boolean isRoot;
    private boolean isLeaf;
    List<WoPersonTypeTree> children=new ArrayList<>();
    public void setChildren(List<WoPersonTypeTree> children) {
        if (children==null){
            this.isLeaf=true;
        }
        this.children = children;
    }
    public WoPersonTypeTree(WoPersonType woPersonType){
        this.setId(woPersonType.getId());
        this.key=woPersonType.getId();
        this.value=woPersonType.getId();
        this.title=woPersonType.getTypeName()+" "+woPersonType.getTypeCode();
        this.setTypeCode(woPersonType.getTypeCode());
        this.setTypeName(woPersonType.getTypeName());
    }
}
